home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_08 / 9n08103b < prev    next >
Text File  |  1991-06-04  |  464b  |  32 lines

  1. /* CUJ example, Stephen D. Williams, SDW Systems */
  2.  
  3. #include <stdio.h>
  4.  
  5. main()
  6.     {
  7.     char *ptr = "hi there george";
  8.     
  9.     puts(ptr);
  10.     
  11.     /*  ((long *)&ptr)++; <---incorrect */
  12.     
  13.      (*((long**)&ptr))++;
  14.     puts(ptr);
  15.     
  16. #define ptr_type(type, prt) (*((type**)&ptr))
  17.     puts((char *)++(ptr_type(long,ptr)));
  18. #undef ptr_type /* scoped macro*/
  19.     }
  20.         
  21. /* 
  22.  
  23. output:
  24.  
  25. hi there george
  26. here george
  27.  george
  28.  
  29. */
  30.  
  31.  
  32.